Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed manual conversion to local time in date conversions #55

Merged
merged 2 commits into from
Sep 21, 2018

Conversation

Ablu
Copy link
Collaborator

@Ablu Ablu commented Sep 3, 2018

Calling ToLocalTime() leads to changes of the hour component. Since in JavaScript Date is basically simply a number starting from 1970-01-01 UTC we should not do any conversions here. This also means that the test which simply checked that new Date(2010, 9, 10) equals new DateTime(2010, 10, 10) was wrong. C# does not do any conversions by default, so new DateTime(2010, 10, 10) does not specificy any timezone. The JavaScript code should match the UTC Date of 2010-10-10 (00:00:00) converted to the local timezone, for example, 2010-10-09 (22:00:00) for MESZ (GMT+2).

@Ablu Ablu changed the title Datetime Removed manual conversion to local time in date conversions Removed manual conversion to local time in date conversions Sep 3, 2018
@Ablu
Copy link
Collaborator Author

Ablu commented Sep 3, 2018

Interesting... The Appveyor build fails when comparing new Date() with the current DateTime from C#... Locally it works. I will try to see what goes wrong there...

DateTime overloads the - operator.
@Ablu
Copy link
Collaborator Author

Ablu commented Sep 21, 2018

@spahnke would be cool if you could check whether the tests make sense. Date stuff is always ugly... :/.

@oliverbock should work now :)

@Ablu
Copy link
Collaborator Author

Ablu commented Sep 21, 2018

somehow github did not handle my forced push to my branch...

JavaScript usually does not care a lot about timezones, but since the
conversion happens via milliseconds since epoch (which is UTC based) one
needs to be a bit careful about which conversions to do where.

Added/moved tests to a central place so there is an overview over all
date related tests.
@Ablu
Copy link
Collaborator Author

Ablu commented Sep 21, 2018

Ok. A second forced push fixed it

@spahnke
Copy link
Collaborator

spahnke commented Sep 21, 2018

I will review this on Monday.

@Ablu
Copy link
Collaborator Author

Ablu commented Sep 21, 2018

CI failure is an unrelated test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants